<%@page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="web" uri="http://meerkat.qunar.com/web"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<web:designCss/>
<%@include file="/WEB-INF/include/head.jsp" %>
</head>
<body>
    <div class="wrapper">
        <web:titleBar title="更新菜单" />

        <div class="main content">
        <form id="resUpdateForm">
            <table class="comm_form_table">
            <tr>
                <th>ID: </th>
                <td><input type="text" id="id" name="id" value="${resource.id}" readonly="true"/></td>
            </tr>
            <tr>
                <th>父ID: </th>
                <td><input type="text" id="parentId" name="parentId" value="${resource.parentId}" readonly="true"/></td>
            </tr>
            <tr>
                <th><span style="color:red;">*</span>名称: </th>
                <td><input type="text" id="name" name="name" value="${resource.name}" /></td>
            </tr>
            <tr>
                <th>控制器: </th>
                <td><input type="text" id="controller" name="controller" value="${resource.controller}" /></td>
            </tr>
            <tr>
                <th>动作: </th>
                <td><input type="text" id="action" name="action" value="${resource.action}" /></td>
            </tr>
            <tr>
                <th><span style="color:red;">*</span>区域: </th>
                <td>
                    <select id="type" name="type">
						<option value="0" <c:if test="${resource.type==0}">selected="true"</c:if>>顶部</option>
						<option value="1" <c:if test="${resource.type==1}">selected="true"</c:if>>左侧</option>
						<option value="2" <c:if test="${resource.type==2}">selected="true"</c:if>>隐藏</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th><span style="color:red;">*</span>描述: </th>
                <td><textarea id="description" name="description" cols="40" rows="10">${resource.description}</textarea></td>
            </tr>
	    	<tr>
                <th><span style="color:red;">*</span>权重: </th>
                <td>
				    <select id="sort" name="sort">
						<c:forEach begin="0" end="999" var="sortnum">
						    <option value="${sortnum}" <c:if test="${resource.sort == sortnum}">selected="true"</c:if>>${sortnum}</option>
						</c:forEach>
	                </select>
				</td>
            </tr>
            <tr>
                <td colspan="2" class="comm_center">
                    <input type="submit" class="button button-blue" value="提交"/>
                </td>
            </tr>
            </table>
        </form>
        </div>
    </div>
    <script type="text/javascript">
    $(document).ready(function(){
        $('#resUpdateForm').bind("submit", function(){
            return Qadmin.FW.Ajax.post({
                url: QG_CONFIG.PATH + 'resource/update.htm',
                formId: "resUpdateForm"
            }, function(){
    		    location.href= QG_CONFIG.PATH + 'resource/list.htm';
    		});
        });
    });
    </script>
</body>
</html>
